<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>重特大案件立案信息</title>
    <link rel="stylesheet" type="text/css" href="css/base.css"/>
    <script type="text/javascript" src="js/jquery-1.6.2.js"></script>
    <link rel="stylesheet" type="text/css" href="css/infoCss.css"/>
    <script type="text/javascript" src="js/jquery.reveal.js"></script>
    <script type="text/javascript" src="js/kkpager-1.3.js"></script>
    <link rel="stylesheet" type="text/css" href="css/kkpager_orange.css"/>
    <link rel="stylesheet" href="css/reveal.css"/>
    <script type="text/javascript">
        $(function () {
            $("#dataSubmit").click(function () {
                if ($("#csvFile").val() == "") {
                    alert("请先选择文件！");
                    return;
                }
                $("#dataForm").submit();
                $("#myModal").css("display", "none");
                $(".reveal-modal-bg").css("display", "none");
            });
        });
    </script>
</head>

<body id="body_main" style="background: #3894cc;">
<img src="img/img_title2.jpg"
     style="width: 100%; top: 0px; position: absolute;"/>
<div id="div_main"
     style="height: 100%; top: 91px; margin: auto; position: absolute; width: 100%; padding-left: 8px;">
    <div
            style="height: 100%; position: relative; background: #eaeaea; width: 99%; float: left;">
        <div style="height: 20%; top: 2px; position: absolute;">
            <div class="sjxxdiv">
                当前位置：<a href="mainPolice.jsp">主页</a>-> <a href="sjxxdr.jsp">数据信息导入</a>->
                <a style="color: red;" class='havTip'>重特大案件立案信息
                    <div class='tooltip_description' style='display: none'
                         title='案件类型'>
                        <ul>
                            <li>严重暴力犯罪案件</li>
                            <li>涉众型经济犯罪案件</li>
                            <li>舆情关注案件</li>
                            <li>涉黑涉恐涉邪教案件</li>
                            <li>上级督办案件</li>
                            <li>有重大社会影响案件</li>
                            <li>人数罪名事实较多案件</li>
                        </ul>
                    </div>
                </a>
            </div>
            <table class="search_table" style="width: 98%; height: 100%;">
                <tr class="search_title" style="height: 20%;">
                    <td colspan="3" style="border-right: 0; width: 50%;"><span
                            class="searchTitle">筛选条件</span></td>
                    <td style="border-left: 0; border-right: 0; width: 20%;">
                        &nbsp;
                    </td>
                    <td colspan="2"
                        style="border-left: 0; text-align: center; width: 40%;">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" id="addBtn"
                                                         class='big-link' data-reveal-id='myModal3'><span
                            class="button red">添加</span></a> &nbsp;&nbsp;<a href="#"
                                                                            id="seachBtn"><span class="button red">筛选</span></a> &nbsp;&nbsp;
                        <a href="#" id="dataInput" class="big-link"
                           data-reveal-id="myModal"> <span class="button red">立案数据导入</span></a>
                    </td>
                </tr>
                <tr>
                    <td class="table_search_1">立案时间</td>
                    <td class="table_search_2"><input type="text" id="lasj"
                                                      placeholder="立案时间" autocomplete="on"/></td>
                    <td class="table_search_1">嫌疑人姓名</td>
                    <td class="table_search_2"><input type="text" id="xm"
                                                      placeholder="嫌疑人姓名" autocomplete="on"/></td>
                    <td class="table_search_1">案件编号</td>

                    <td class="table_search_3"><input type="text" id="ajbh"
                                                      placeholder="案件编号" autocomplete="on"/></td>
                </tr>
                <tr>
                    <td class="table_search_1">简要案情</td>
                    <td colspan="3" style="background: white;"><input type="text"
                                                                      id="jyaq" placeholder="简要案情" autocomplete="on"/></td>
                    <td class="table_search_1"></td>
                    <td class="table_search_3"></td>
                </tr>
            </table>

        </div>

        <div
                style="height: 50%; top: 30%; width: 100%; position: absolute; padding-bottom: 20px; overflow: auto;">
            <div
                    style="width: 98%; height: 40px; margin: auto; line-height: 40px;">
                <span class="searchTitle">查询结果</span>
            </div>
            <table id="tablesorter" class="tablesorter"
                   style="width: 98%; margin: auto;">
                <thead>
                <tr>
                    <th class="sorter-text" style="width: 100px;">立案时间</th>
                    <th class="sorter-text">案由及嫌疑人</th>
                    <th class="sorter-text">案件编号</th>
                    <th class="sorter-text">强制措施情况</th>
                    <th class="sorter-text">简要案情</th>
                    <th class="sorter-text">主办单位（承办人）</th>
                    <th class="sorter-text">处理结果</th>
                    <th class="sorter-text">备注</th>
                    <th class="sorter-text">状态</th>
                    <th class="sorter-text">时间</th>
                    <th class="sorter-text">操作</th>
                </tr>
                </thead>
                <tbody id="content">

                </tbody>
            </table>
            <div id="kkpager" style="width: 800px; margin: 10px auto;"></div>
        </div>
    </div>

</div>
<div id="div_foot"
     style="text-align: center; position: absolute; height: 36px; line-height: 36px; bottom: 0px; width: 100%;">
		<span style="color: white;">版权所有 南京安信达信息科技有限公司 © 2017-2020.All
			rights reserved.</span>
</div>

<div id="myModal" class="reveal-modal">
    <form action="laInput.action" id="dataForm" method="post"
          enctype="multipart/form-data">
        <div style="width: 100%; text-align: center;">
            <ul>
                <li><input type="file" name="csvFile"/></li>
                <li><a href="#" id="dataSubmit"
                       style="margin-left: 10px; background: blue; padding: 5px 10px; color: white;">上传</a></li>
            </ul>
        </div>
        <a class="close-reveal-modal">&#215;</a>
    </form>
</div>
<div id="myModal3" class="reveal-modal"
     style="width: 700px; height: 250px;">
    <input type="hidden" name="page" id="page" value="laInfo">
    <table style="margin: auto; width: 95%;">
        <tr>
            <td class="tdTitle">案发时间</td>
            <td><input id="afsj" name="afsj" type="text"/></td>
            <td class="tdTitle">案由</td>
            <td><input id="banr" name="banr" type="text"/></td>

        </tr>
        <tr>
            <td class="tdTitle">案件编号</td>
            <td><input id="ajbh" name="ajbh" type="text"/></td>
            <td class="tdTitle">身份证号码</td>
            <td><input id="sfzh" name="sfzh" type="text"/></td>
        </tr>
        <tr>
            <td class="tdTitle">嫌疑人</td>
            <td><input id="fzxyr" name="fzxyr" type="text"/></td>
            <td class="tdTitle">性别</td>
            <td><input id="xb" name="xb" type="text"/></td>
        </tr>
        <tr>
            <td class="tdTitle">出生日期</td>
            <td><input id="csrq" name="csrq" type="text"/></td>
            <td class="tdTitle">主办单位</td>
            <td><input id="cbdw" name="cbdw" type="text"/></td>
        </tr>
        <tr>
            <td class="tdTitle" style="line-height: 80px;">简要案情</td>
            <td colspan="4"><textarea id="jyaq" name="jyaq"
                                      style="height: 100%; width: 97%"></textarea></td>
        </tr>
        <tr>
            <td class="tdTitle">上传时间</td>
            <td><input id="time" name="time" type="text"/></td>
            <td class="tdTitle">处理结果</td>
            <td><input id="cljg" name="cljg" type="text"/></td>
        </tr>
        <tr>
            <td class="tdTitle">破案时间</td>
            <td><input id="pasj" name="pasj" type="text"/></td>
            <td class="tdTitle">备注</td>
            <td><input id="bz" name="bz" type="text"/></td>
        </tr>
        <tr>
            <td colspan="4" style="padding-top: 20px; text-align: center;">
                <a href="#" id="LaSubmit"
                   style="margin-left: 10px; background: blue; padding: 5px 10px; color: white;">提交</a>
                <a href="#" id="LaSubmit2"
                   style="margin-left: 10px; background: blue; padding: 5px 10px; color: white;">修改</a>
            </td>
        </tr>
    </table>
    </form>
    <a class="close-reveal-modal">&#215;</a>
</div>
</body>
<link rel="stylesheet" href="css/jquery.tooltip.css" type="text/css"/>
<!-- jQuery -->
<script type="text/javascript" src="js/jquery-1.6.2.js"></script>

<!-- Demo stuff -->

<link href="js/docs/css/prettify.css" rel="stylesheet">
<script src="js/docs/js/prettify.js"></script>
<script src="js/docs/js/docs.js"></script>

<!-- Tablesorter: required -->
<link rel="stylesheet" href="js/dist/css/theme.blue.css">
<script src="js/dist/js/jquery.tablesorter.js"></script>

<script id="js">
    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    };
    function getFormatDate(arg) {
        if (arg == undefined || arg == '') {
            return '';
        }

        var re = arg + '';
        if (re.length < 2) {
            re = '0' + re;
        }

        return re;
    }
    $("#LaSubmit2").click(function () {
        $.ajax({
            url: "yzLaAj.action",
            type: 'POST',
            dataType: 'JSON',
            data: {
                ajbh: $("#ajbh").val()
            }
        });
        $("#LaSubmit").click(function () {
            $("#ajbh").val(ajbh);
            if ($("#ajbh").val() == "") {
                alert("请填写案件编号");
                return;
            }
            $.ajax({
                url: "yzLaAj.action",
                type: 'POST',
                dataType: 'JSON',
                data: {
                    ajbh: $("#ajbh").val()
                },
                error: function (err) {
                    console.log(err);//console.log(err);//if(err.responseText.indexOf("<title>栖霞检察院登录</title>")>0)alert("请重新登录");window.location.href="login.jsp";
                }, success: function (data) {
                    if (data.lst.length > 0) {
                        alert("案件编号已经存在");
                    } else {
                        $.ajax({
                            url: "addLa.action",
                            type: 'POST',
                            dataType: 'JSON',
                            data: {
                                ajbh: $("#ajbh").val(),
                                pasj: $("#pasj").val(),
                                bz: $("#bz").val(),
                                fzxyr: $("#fzxyr").val(),
                                xb: $("#xb").val(),
                                csrq: $("#csrq").val(),
                                jyaq: $("#jyaq").val(),
                                cbdw: $("#cbdw").val(),
                                time: $("#time").val(),
                                sfzh: $("#sfzh").val(),
                                bannr: $("#banr").val(),
                                lasj: $("#lasj").val(),
                                qzcs: $("#qzcs").val(),
                                page: page
                            },
                            error: function (err) {
                                console.log(err);//console.log(err);//if(err.responseText.indexOf("<title>栖霞检察院登录</title>")>0)alert("请重新登录");window.location.href="login.jsp";
                            }, success: function (data) {
                                $("#myModal3").css("display", "none");
                                $(".reveal-modal-bg").css("display", "none");
                            }
                        });
                    }
                }
            });

        });
        $("#addBtn").live("click", function () {
            $("#ajbh").val("");
            $("#afsj").val("");
            $("#pasj").val("");
            $("#bz").val("");
            $("#fzxyr").val("");
            $("#xb").val("");
            $("#csrq").val("");
            $("#jyaq").val("");
            $("#cbdw").val("");
            $("#cljg").val("");
            $("#time").val("");
            $("#sfzh").val("");
            $("#banr").val("");
            $("#LaSubmit2").css("display", "none");


        });
        function addDate(date, days) {
            if (days == undefined || days == '') {
                days = 1;
            }
            var date = new Date(date);
            date.setDate(date.getDate() + days);
            var month = date.getMonth() + 1;
            var day = date.getDate();
            return date.getFullYear() + '-' + getFormatDate(month) + '-' + getFormatDate(day);
        }

        function AutoSize() {
            var x = $(window).width() / 1920;
//			var y = $(window).height() / 92;
            var hp = 92 * x;
            $("#div_main").css("top", hp + "px");
        }

        function loadData(pageNo, isInit) {
            if (pageNo == "undefined" || pageNo == '') {
                pageNo = 1;
            }
            if (pageNo == 1) {
                isInit = true;
            } else {
                isInit = false;
            }
            $.ajax({
                url: "selectLaInfo.action",
                type: 'POST',
                dataType: 'JSON',
                data: {
                    lasj: $("#lasj").val(),
                    xm: $("#xm").val(),
                    ajbh: $("#ajbh").val(),
                    jyaq: $("#jyaq").val(),
                    pageNo: pageNo
                },
                error: function (err) {
                    console.log(err);//console.log(err);//if(err.responseText.indexOf("<title>栖霞检察院登录</title>")>0)alert("请重新登录");window.location.href="login.jsp";
                },
                success: function (data) {
                    $("#content").html("");
                    var time1 = new Date().Format("yyyy-MM-dd");
                    var time2 = addDate(new Date(), -7);
                    var trs = "";
                    for (var i = 0; i < data.lst.length; i++) {
                        var zt = "已读";
                        var sty = "style='color:#666666 !important'";
                        if (data.lst[i].zt == '0' || data.lst[i].zt == 0) {
                            zt = "未读";
                            sty = "style='color:#000000 !important'";
                        }
// 						if(data.lst[i].isNtb!="0"&&data.lst[i].isNys!="0"){
// 							sty="style='color:red !important'";
// 						}else if(data.lst[i].isNtb!="0"){
// 							sty="style='color:green !important'";
// 						}else if(data.lst[i].isNys!="0"){
// 							sty="style='color:blue !important'";
// 						}
                        var qzcs = "无";
                        if (data.lst[i].qzcs == null || data.lst[i].qzcs == "") {
                            qzcs = "无";
                        } else {
                            qzcs = data.lst[i].qzcs;
                        }
                        var cljg = "无";
                        if (data.lst[i].cljg == null || data.lst[i].cljg == "") {
                            cljg = "无";
                        } else {
                            cljg = data.lst[i].cljg;
                        }
                        trs += "<tr>" +
                            "<td " + sty + ">" + data.lst[i].lasj + "</td>" +
                            "<td class='havTip' " + sty + ">" + data.lst[i].ay + "" +
                            "<div class='tooltip_description' style='display:none' title='案由及嫌疑人'>" +
                            "<ul>" +
                            "<li>" + data.lst[i].ay + "" +
                            "</li>" +
                            "</ul>" +
                            "</div>" +
                            "</td>" +
                            "<td " + sty + ">" + data.lst[i].ajbh + "</td>" +
// 							"<td>"+ data.lst[i].fzxyr+"</td>"+
                            "<td " + sty + ">" + qzcs + "</td>" +
                            "<td class='havTip' " + sty + ">" + data.lst[i].jyaq +
                            "<div class='tooltip_description' style='display:none' title='简要案情'>" +
                            "<ul>" +
                            "<li>" +
                            data.lst[i].jyaq +
                            "</li>" +
                            "</ul>" +
                            "</div>" +
                            "</td>" +
                            "<td " + sty + ">" + data.lst[i].cbdw + "</td>" +
                            "<td " + sty + ">" + cljg + "</td>" +
                            "<td " + sty + ">" + data.lst[i].bz + "</td>" +
                            "<td " + sty + ">" + zt + "</td>" +
                            "<td " + sty + ">" + data.lst[i].time + "</td>" +
                            "<td>" +
                            "<a href='#' ajbh='" + data.lst[i].ajbh + "' sfzh='" + data.lst[i].sfzh + "' id='updateLa'  class='big-link' data-reveal-id='myModal3'>" +
                            "修改</a>";
                        trs += "<a style='margin-left:5px;' href='#' ajbh='" + data.lst[i].ajbh + "' sfzh='" + data.lst[i].sfzh + "' id='deleLa'>" +
                            "删除</a>";
                        trs +=
                            "</td>"
                        "</tr>";
                    }
                    if (trs == "") {

                        trs += "<tr><td colspan='8' style='text-align: center;'>无数据</td></tr>";
                    }
                    $("#content").append(trs.replace(/null/g, ""));
                    var pb = data.pb;
                    pageapp(pb.pageCount, pb.rowsCount, pb.pageNo, isInit);
                    jQuery.getScript("js/jquery.tooltip.js")
                        .done(function () {
                            $j = jQuery.noConflict();
                            $j(document).ready(function () {
                                $j(".havTip").tooltip();
                            });
                        })
                        .fail(function () {
                            console.log("js加载失败");
                        });
                    $(function () {
                        $("#tablesorter").tablesorter({
                            theme: 'blue'
                        });
                    });
                    $("#tablesorter").ready(function () {
                        $("#tablesorter").tablesorter();
                    });
                }
            });
        }

        var curPage = 1;

        function pageapp(totalPage, totalRecords, pageNo, isInit) {
            if (!pageNo) {
                pageNo = 1;
            }
            $("#kkpager").empty();
            kkpager.total = totalPage;
            kkpager.totalRecords = totalRecords;
            //生成分页
            //有些参数是可选的，比如lang，若不传有默认值
            kkpager.generPageHtml({
                pno: pageNo,
                //总页码
                total: totalPage,
                //总数据条数
                totalRecords: totalRecords,
                mode: 'click',//默认值是link，可选link或者click
                click: function (n) {
                    curPage = n;
                    loadData(n, false);
                    //手动选中按钮
                    this.selectPage(n);
                    // do something
                    return false;
                }
            }, isInit);
        }

        $("#updateLa").live("click", function () {
            $("#LaSubmit").css("display", "none");
            var ajbh = $(this).attr("ajbh");
            $.ajax({
                url: "selectLabyAjbh.action",
                type: 'POST',
                dataType: 'JSON',
                data: {
                    ajbh: ajbh
                },
                error: function (err) {
                    console.log(err);//console.log(err);//if(err.responseText.indexOf("<title>栖霞检察院登录</title>")>0)alert("请重新登录");window.location.href="login.jsp";
                },
                success: function (data) {
                    $("#myModal3 #afsj").val(data.lst[0].afsj);
                    $("#myModal3 #banr").val(data.lst[0].banr);
                    $("#myModal3 #ajbh").val(data.lst[0].ajbh);
                    $("#myModal3 #pasj").val(data.lst[0].pasj);
                    $("#myModal3 #fzxyr").val(data.lst[0].fzxyr);
                    $("#myModal3 #xb").val(data.lst[0].xb);
                    $("#myModal3 #csrq").val(data.lst[0].csrq);
                    $("#myModal3 #cbdw").val(data.lst[0].cbdw);
                    $("#myModal3 #jyaq").val(data.lst[0].jyaq);
                    $("#myModal3 #cljg").val(data.lst[0].cljg);
                    $("#myModal3 #time").val(data.lst[0].time);
                    $("#myModal3 #bz").val(data.lst[0].bz);
                    $("#myModal3 #ajbh").css("readonly", "readonly");
                    $("#myModal3 #fzxyr").css("readonly", "readonly");
                }
            });
        });
        $("#deleLa").live("click", function () {
            if (confirm("是否确定删除？")) {
                var ajbh = $(this).attr("ajbh");
                $.ajax({
                    url: "deleLaAj.action",
                    type: 'POST',
                    dataType: 'JSON',
                    data: {
                        ajbh: ajbh
                    },
                    error: function (err) {
                        console.log(err);//console.log(err);//if(err.responseText.indexOf("<title>栖霞检察院登录</title>")>0)alert("请重新登录");window.location.href="login.jsp";
                    },
                    success: function (data) {
                        loadData(1, true);
                    }
                });
            }
        });
        $("#seachBtn").click(function () {
            loadData(1, true);
        });
        $(document).ready(function () {
            AutoSize();
            loadData(1, true);
        });
        window.onresize = function () {
            AutoSize();
        }
    });
</script>

</html>